package com.tarena.lbs.attach.controller;

import com.tarena.lbs.attach.pojo.dto.AttachDTO;
import com.tarena.lbs.attach.pojo.vo.FileVO;
import org.springframework.stereotype.Component;

@Component
public class AttachConverter {

    public FileVO assembleDtoToFileVo(AttachDTO attachDTO) {
        if (attachDTO == null) {
            return null;
        }
        FileVO fileVO = new FileVO();
        fileVO.setId(attachDTO.getId());
        fileVO.setName(attachDTO.getFileName());
        fileVO.setSize(attachDTO.getFileSize());
        fileVO.setUrl(""); // 可在 controller 中再设置 url
        return fileVO;
    }
}
